package com.boot.generic;

import java.io.Serializable;

public class GenericMethod {

    public <T> T genericMethod(T...a){
        return a[a.length / 2];
    }

    /**
     * 泛型方法 泛型声明在<>内
     */
    public <K,E> E getA(K k,E e){
        return e;
    }

    /** 上界 */
    public static <T extends Comparable & Serializable> T min(T a, T b){
        if(a.compareTo(b) > 0) return a; else return b;
    }

    public static void main(String[] args) {
        GenericMethod genericMethod = new GenericMethod();
        Integer integer = genericMethod.genericMethod(1);
    }
}
